<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue生命周期钩子方法</title>
</head>
<body>
    <div id="app">
        <button @click="count --">减</button>
        {{count}}
        <button @click="count ++ ">加</button>
    </div>
</body>

<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<!-- axios -->
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

<script>
    const app = new Vue({
        el:'#app',
        data:{
            count:0
        },
        beforeCreate() {
            alert("开始创建Vue实例...");
            console.log(this.count) ;
        },
        created() {
            alert("Vue实例创建完成...");
            console.log(this.count) ;
        },
        beforeMounte() {
            alert("开始挂载dom属性...");
            console.log(this.count) ;
        },
        mounted() {
            alert("属性挂载完成...");
            console.log(this.count) ;
        },
        beforeUpdate() {
            alert("元素修改之前...");
            console.log(this.count) ;
        },
        updated() {
            alert("元素修改之后...");
            console.log(this.count) ;
        },
        beforeDestory() {
            alert("开始销毁Vue实例...");
            console.log(this.count) ;
        },
        destoryed() {
            alert("Vue实例销毁完成...");
            console.log(this.count) ;
        }
    })
</script>

</html>